package com.crazy.bookstore.service;

import com.crazy.bookstore.mapper.TestMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class TestService {
    @Resource
    TestMapper testMapper;

    @Transactional
    public void batchInsert(){

        for (int i=0;i<5;i++){
//            /*模拟出错*/
//            if(i==2){
//                throw new RuntimeException("模拟出错");
//            }
            testMapper.insertSample();
        }
    }
}
